function hfocus() {
	var vtext = document.getElementById("hname");
	if (vtext.value == "请输入你要查询的饭店名...") {
		vtext.value = "";
	}
}

function hblur() {
	var rtext = document.getElementById("hname");
	if (rtext.value.length == 0) {
		rtext.value = "请输入你要查询的饭店名...";
	}
}

function vfocus() {
	var vtext = document.getElementById("vname");
	if (vtext.value == "请输入你要查询的菜名...") {
		vtext.value = "";
	}
}

function vblur() {
	var rtext = document.getElementById("vname");
	if (rtext.value.length == 0) {
		rtext.value = "请输入你要查询的菜名...";
	}
}

function fuser() {
	spuser.innerHTML = "<font size=2 color=red>·为了方便记忆,您可用手机号注册!</font>";
}

function fpwd() {
	sppwd.innerHTML = "<font size=2 color=red></font>";
}

function fpwd2() {
	sppwd2.innerHTML = "<font size=2 color=red></font>";
}

function femail() {
	spemail.innerHTML = "<font size=2 color=red>·邮箱的格式为：xxx@xxx.xxx</font>";
}

function faddress() {
	spaddress.innerHTML = "<font size=2 color=red>·这里填写的是您所选区域内的地址!</font>";
}

function fphone() {
	spphone.innerHTML = "<font size=2 color=red>·为了方便联系,请正确填写联系方式!</font>";
}

function hotelname() {
	spHotelname.innerHTML = "<font size=2 color=red>·请填写饭店名称!</font>";
}

function hotelAddress() {
	spaddress.innerHTML = "<font size=2 color=red>·请填写饭店的地址!</font>";
}

function hotelrelation() {
	sprelation.innerHTML = "<font size=2 color=red>·为方便联系,请正确填写饭店联系人!</font>";
}

function checkuser() {
	var usernames = document.getElementById("user_1").value;
	var zz = /^\w{4,18}$/
	if (zz.test(usernames)) {
		spuser.innerHTML = "<font size=2 color=blue>·OK!</font>";
		var zzz = /^1[3|4|5|8][0-9]\d{8}$/
		if (zzz.test(usernames)) {
			var usertels = document.getElementById("phone_1");
			usertels.value = usernames;
			spphone.innerHTML = "<font size=2 color=blue>·OK!</font>";
		}
	} else {
		spuser.innerHTML = "<font size=2 color=red>·请输入4-18个字符,包括字母、数字、下划线!</font>";
	}
}
function checkSenduser() {
	var usernames = document.getElementById("user_2").value;
	var zz = /^\w{4,18}$/
	if (zz.test(usernames)) {
		spuser.innerHTML = "<font size=2 color=blue>·OK!</font>";
		var zzz = /^1[3|4|5|8][0-9]\d{8}$/
		if (zzz.test(usernames)) {
			var usertels = document.getElementById("phone_2");
			usertels.value = usernames;
			spphone.innerHTML = "<font size=2 color=blue>·OK!</font>";
		}
	} else {
		spuser.innerHTML = "<font size=2 color=red>·请输入4-18个字符,包括字母、数字、下划线!</font>";
	}
}
function checkHoteluser() {
	var usernames = document.getElementById("user_3").value;
	var zz = /^\w{4,18}$/
	if (zz.test(usernames)) {
		spuser.innerHTML = "<font size=2 color=blue>·OK!</font>";
		var zzz = /^1[3|4|5|8][0-9]\d{8}$/
		if (zzz.test(usernames)) {
			var usertels = document.getElementById("phone_3");
			usertels.value = usernames;
			spphone.innerHTML = "<font size=2 color=blue>·OK!</font>";
		}
	} else {
		spuser.innerHTML = "<font size=2 color=red>·请输入4-18个字符,包括字母、数字、下划线!</font>";
	}
}

function checkpwd() {
	var passwords = document.getElementById("pwd_1").value;
	var zz = /^\w{4,16}$/
	if (zz.test(passwords)) {
		sppwd.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		sppwd.innerHTML = "<font size=2 color=red>·请输入4-16个字符,包括字母、数字、下划线!</font>";
	}
}
function checkSendpwd() {
	var passwords = document.getElementById("pwd_2").value;
	var zz = /^\w{4,16}$/
	if (zz.test(passwords)) {
		sppwd.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		sppwd.innerHTML = "<font size=2 color=red>·请输入4-16个字符,包括字母、数字、下划线!</font>";
	}
}
function checkHotelpwd() {
	var passwords = document.getElementById("pwd_3").value;
	var zz = /^\w{4,16}$/
	if (zz.test(passwords)) {
		sppwd.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		sppwd.innerHTML = "<font size=2 color=red>·请输入4-16个字符,包括字母、数字、下划线!</font>";
	}
}

function checkpwd2() {
	var passwords = document.getElementById("pwd_1").value;
	var passwords2 = document.getElementById("repwd_1").value;
	if (passwords != passwords2) {
		sppwd2.innerHTML = "<font size=2 color=red>·对不起,两次密码不一致!</font>";
	} else {
		sppwd2.innerHTML = "<font size=2 color=blue>·OK!</font>";
	}
}
function checkSendpwd2() {
	var passwords = document.getElementById("pwd_2").value;
	var passwords2 = document.getElementById("repwd_2").value;
	if (passwords != passwords2) {
		sppwd2.innerHTML = "<font size=2 color=red>·对不起,两次密码不一致!</font>";
	} else {
		sppwd2.innerHTML = "<font size=2 color=blue>·OK!</font>";
	}
}
function checkHotelpwd2() {
	var passwords = document.getElementById("pwd_3").value;
	var passwords2 = document.getElementById("repwd_3").value;
	if (passwords != passwords2) {
		sppwd2.innerHTML = "<font size=2 color=red>·对不起,两次密码不一致!</font>";
	} else {
		sppwd2.innerHTML = "<font size=2 color=blue>·OK!</font>";
	}
}

function checkemail() {
	var zz = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
	var useremails = document.getElementById("email_1").value;
	if (zz.test(useremails)) {
		spemail.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spemail.innerHTML = "<font size=2 color=red>·对不起,您输入的邮箱地址有误!</font>";
	}
}
function checkSendemail() {
	var zz = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
	var useremails = document.getElementById("email_2").value;
	if (zz.test(useremails)) {
		spemail.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spemail.innerHTML = "<font size=2 color=red>·对不起,您输入的邮箱地址有误!</font>";
	}
}

function checkphone() {
	var zz = /\d{3}-\d{8}|\d{4}-\d{7}|^1[3|4|5|8][0-9]\d{8}$/
	var usertels = document.getElementById("phone_1").value;
	if (zz.test(usertels)) {
		spphone.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spphone.innerHTML = "<font size=2 color=red>·请填写正确的固定电话或者手机号码!</font>";
	}
}
function checkSendphone() {
	var zz = /\d{3}-\d{8}|\d{4}-\d{7}|^1[3|4|5|8][0-9]\d{8}$/
	var usertels = document.getElementById("phone_2").value;
	if (zz.test(usertels)) {
		spphone.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spphone.innerHTML = "<font size=2 color=red>·请填写正确的固定电话或者手机号码!</font>";
	}
}
function checkHotelphone() {
	var zz = /\d{3}-\d{8}|\d{4}-\d{7}|^1[3|4|5|8][0-9]\d{8}$/
	var usertels = document.getElementById("phone_3").value;
	if (zz.test(usertels)) {
		spphone.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spphone.innerHTML = "<font size=2 color=red>·请填写正确的固定电话或者手机号码!</font>";
	}
}

function checkaddress() {
	var zz = /[\u4e00-\u9fa5]/
	var useremails = document.getElementById("address_1").value;
	if (zz.test(useremails)) {
		spaddress.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spaddress.innerHTML = "<font size=2 color=red>·请填写正确的送餐地址!</font>";
	}
}
function checkHoteladdress() {
	var zz = /[\u4e00-\u9fa5]/
	var useremails = document.getElementById("address_3").value;
	if (zz.test(useremails)) {
		spaddress.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spaddress.innerHTML = "<font size=2 color=red>·请填写正确的饭店地址!</font>";
	}
}

function checkHotelname() {
	var zz = /[\u4e00-\u9fa5]/
	var useremails = document.getElementById("shopname_3").value;
	if (zz.test(useremails)) {
		spHotelpname.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		spHotelname.innerHTML = "<font size=2 color=red>·请填写中文格式的店名!</font>";
	}
}

function checkrelation() {
	var zz = /[\u4e00-\u9fa5]/
	var useremails = document.getElementById("relation").value;
	if (zz.test(useremails)) {
		sprelation.innerHTML = "<font size=2 color=blue>·OK!</font>";
	} else {
		sprelation.innerHTML = "<font size=2 color=red>·请填写正确的联系人姓名!</font>";
	}
}

function abolishUser() {
	if (confirm("您是否真的要退出注册吗?")) {
		window.location.href = "/onlinehotel/index.jsp";
	}
}

function submitUser() {
	var usernames = document.getElementById("user_1").value;
	var passwords = document.getElementById("pwd_1").value;
	var passwords2 = document.getElementById("repwd_1").value;
	var usertels = document.getElementById("phone_1").value;
	var addresss = document.getElementById("address_1").value;
	if (usernames.length < 1) {
		spuser.innerHTML = "<font size=2 color=red>·请输入账号</font>";
	} else if (passwords.length < 1) {
		sppwd.innerHTML = "<font size=2 color=red>·请输入密码</font>";
	} else if (passwords2.length < 1) {
		sppwd2.innerHTML = "<font size=2 color=red>·请再次输入密码</font>";
	} else if (usertels.length < 1) {
		spphone.innerHTML = "<font size=2 color=red>·请输入电话号码</font>";
	} else if (addresss.length < 1) {
		spaddress.innerHTML = "<font size=2 color=red>·请输入联系地址</font>";
	} else {
		userinformation.submit();
	}
}

function submitSend() {
	var usernames = document.getElementById("user_2").value;
	var passwords = document.getElementById("pwd_2").value;
	var passwords2 = document.getElementById("repwd_2").value;
	var usertels = document.getElementById("phone_2").value;
	if (usernames.length < 1) {
		spuser.innerHTML = "<font size=2 color=red>·请输入账号</font>";
	} else if (passwords.length < 1) {
		sppwd.innerHTML = "<font size=2 color=red>·请输入密码</font>";
	} else if (passwords2.length < 1) {
		sppwd2.innerHTML = "<font size=2 color=red>·请再次输入密码</font>";
	} else if (usertels.length < 1) {
		spphone.innerHTML = "<font size=2 color=red>·请输入电话号码</font>";
	} else {
		sendinformation.submit();
	}
}

function submitHotel() {
	var users = document.getElementById("user_3").value;
	var pwds = document.getElementById("pwd_3").value;
	var pwds2 = document.getElementById("repwd_3").value;
	var restaurant = document.getElementById("shopname_3").value;
	var relations = document.getElementById("relation").value;
	var usertels = document.getElementById("phone_3").value;
	var addresss = document.getElementById("address_3").value;

	if (users.length < 1) {
		spuser.innerHTML = "<font size=2 color=red>·请输入账号</font>";
	} else if (pwds.length < 1) {
		sppwd.innerHTML = "<font size=2 color=red>·请输入密码</font>";
	} else if (pwds2.length < 1) {
		sppwd2.innerHTML = "<font size=2 color=red>·请再次输入密码</font>";
	} else if (restaurant.length < 1) {
		spshopname.innerHTML = "<font size=2 color=red>·请输入饭店名称</font>";
	} else if (relations.length < 1) {
		sprelation.innerHTML = "<font size=2 color=red>·请输入联系人</font>";
	} else if (usertels.length < 1) {
		spphone.innerHTML = "<font size=2 color=red>·请输入联系电话</font>";
	} else if (addresss.length < 1) {
		spaddress.innerHTML = "<font size=2 color=red>·请输入联系地址</font>";
	} else {
		hotelinformation.submit();
	}
}